function check_integer_or_submit(e){

    var err=0;

    $('.hide').hide();

    for input in $('.NeedInteger') {
        $.ajax({
            url : '/right/check?int='+input.attr('id'),
            error : function(xhr) {
                alert('Ajax breaks as an error has occurred');
            },
            success : function (response) {
                if (response.length > 4) {
                    $('div#'+input.attr('id')+'err').show();
                    err = 1;
                }
            }
        });
    }
    return !err;
}



$(document).ready(function(e){
        $('.hide').hide();
        $('#form').submit(check_integer_or_submit);
    })
